/**
 * 1-严重违法，3-失信被执行人（公司），5-被执行人（公司），6-行政处罚，7-经营异常，8-法律诉讼，9-股权出质(公司)，
 * 10-动产抵押，11-欠税公告，12-名称变更，13-开庭公告，14-法院公告，15-法人变更，16-投资人变更，17-主要人员变更，
 * 18-注册资本变更，19-注册地址变更，20-出资情况变更，21-司法协助(公司)，22-清算信息，23-知识产权出质，24-环保处罚，
 * 25-公示催告，26-送达公告，27-立案信息，28-税收违法，29-司法拍卖，30-土地抵押，31-简易注销，32-限制消费令（公司），
 * 34-终本案件，35-股权出质(人)，36-司法协助(人)，45-强制清算，62-涉金融黑名单，38-破产案件，42-违规处理，41-对外担保，
 * 40-抽查检查，63-注销备案，39-询价评估，33-限制消费令（人），46-终本案件（人），47-开庭公告（人），56-法律诉讼（人），
 * 48-法院公告（人），49-送达公告（人），50-立案信息（人），51-股权质押，37-股权质押（人），
 * 71-历史失信被执行人，72-历史被执行人，73-历史限制消费令，74-历史终本案件，75-历史司法协助，76-历史经营异常，70-历史行政处罚，
 * 77-历史股权出质，78-历史动产抵押，79-历史欠税公告，65-产品召回，53-严重违法（已移出），55-经营异常（已移出）
 */

/**
 * title -> 标题
 * field -> 字段名称
 * isDate -> 是否是日期，需要将时间戳转换为日期
 * timeStampNumber -> 将时间戳转为Number
 */

//type=1/7 严重违法/经营异常的表格头
const RISK_TYPE_COLUMN_1 = [{
    title: "列入日期",
    field: "putDate",
    isDate: true,
  },
  {
    title: "列入原因",
    field: "putReason"
  },
  {
    title: "决定列入部门",
    field: "putDepartment",
  },
  {
    title: "列出日期",
    field: "removeDate",
    isDate: true,
  },
  {
    title: "列出原因",
    field: "removeReason"
  },
  {
    title: "决定列出部门",
    field: "removeDepartment"
  },
];

//type=22清算信息的表格头
const RISK_TYPE_COLUMN_22 = [{
    title: "清算负责⼈",
    field: "manager"
  },
  {
    title: "清算成员名称",
    field: "member"
  },
];

//type=31简易注销的表格头
const RISK_TYPE_COLUMN_31 = [{
    title: "公告申请⽇期",
    field: "result.announcement_apply_date",
    isDate: true,
  },
  {
    title: "简易注销结果",
    field: "result.brief_cancel_result"
  },
  {
    title: "总数",
    field: "total",
  },
  {
    title: "登记机关",
    field: "announcement.reg_authority"
  },
  {
    title: "企业名称",
    field: "announcement.company_name"
  },
  {
    title: "统⼀社会信⽤代码/注册号",
    field: "announcement.credit_code"
  },
  {
    title: "公告期",
    field: "announcement.announcement_term"
  },
  {
    title: "结束⽇期",
    field: "announcement.announcement_end_date"
  },
  {
    title: "承诺书地址",
    field: "announcement.ossPath"
  },
  {
    title: "异议内容",
    field: "objection.objection_content"
  },
  {
    title: "异议时间",
    field: "objection.objection_date",
    isDate: true,
  },
  {
    title: "异议申请",
    field: "objection.objection_apply_person"
  },
];

//type=37股权质押的表格头
const RISK_TYPE_COLUMN_37 = [{
    title: "开始日期",
    field: "startDate",
    isDate: true,
  },
  {
    title: "剩余质押股数（股）",
    field: "pledgeAmount"
  },
  {
    title: "质押股份市值",
    field: "lastValue"
  }, {
    title: "股东",
    field: "shareHolder"
  }, {
    title: "占所持股份⽐例",
    field: "proOfSelf"
  }, {
    title: "公布⽇期",
    field: "annDate",
    isDate: true,
  }, {
    title: "质押⽇收盘单位",
    field: "dayClosePosUnit"
  }, {
    title: "近期质押单位",
    field: "lastValueUnit"
  }, {
    title: "股票单位",
    field: "pledgeAmountUnit"
  }, {
    title: "状态",
    field: "status"
  }, {
    title: "公司id",
    field: "graphId"
  }
];

//type=34终本案件的表格头
const RISK_TYPE_COLUMN_34 = [{
    title: "案号",
    field: "caseCode"
  },
  {
    title: "终本⽇期",
    field: "caseFinalTime",
    isDate: true,
  },
  {
    title: "终本案件详情唯⼀ID",
    field: "businessId"
  }, {
    title: "⽴案时间",
    field: "caseCreateTime",
    isDate: true,
  }, {
    title: "执⾏法院",
    field: "execCourtName"
  }, {
    title: "执⾏标的",
    field: "execMoney"
  }, {
    title: "被执⾏⼈名称",
    field: "zname"
  }
];

//type=74终本案件-历史的表格头
const RISK_TYPE_COLUMN_74 = [{
    title: "案号",
    field: "caseCode"
  },
  {
    title: "终本⽇期",
    field: "caseFinalTime",
    isDate: true,
  },
  {
    title: "身份证号/组织结构代码",
    field: "partyCardNum"
  }, {
    title: "⽴案时间",
    field: "caseCreateTime",
    isDate: true,
  }, {
    title: "执⾏法院",
    field: "execCourtName"
  }, {
    title: "执⾏标的",
    field: "execMoney"
  }, {
    title: "未履⾏⾦额",
    field: "noExecMoney"
  }, {
    title: "被执⾏⼈名称",
    field: "zname"
  }
];

//type=5被执行人的表格头
// const RISK_TYPE_COLUMN_5 = [{
//   title: "案号",
//   field: "caseCode"
// },
// {
//   title: "身份证号／组织机构代码",
//   field: "partyCardNum"
// },
// {
//   title: "被执⾏⼈名称",
//   field: "pname"
// },
// {
//   title: "执⾏法院",
//   field: "execCourtName"
// },{
//   title: "创建时间",
//   field: "caseCreateTime"
// },{
//   title: "执⾏标的（元）",
//   field: "execMoney"
// }
// ];

//type=3失信被执行人的表格头
const RISK_TYPE_COLUMN_3 = [{
    title: "省份地区",
    field: "areaname"
  },
  {
    title: "法院",
    field: "courtname"
  },
  {
    title: "失信⼈类型",
    field: "type",
  },
  {
    title: "案号",
    field: "casecode"
  }, {
    title: "身份证号码/组织机构代码",
    field: "cardnum"
  }, {
    title: "履⾏情况",
    field: "performance"
  }, {
    title: "⽴案时间",
    field: "regdate",
    isDate: true,
  }, {
    title: "发布时间",
    field: "publishdate",
    isDate: true,
  }, {
    title: "做出执⾏的依据单位",
    field: "gistunit"
  }, {
    title: "⽣效法律⽂书确定的义务",
    field: "duty"
  }, {
    title: "执⾏依据⽂号",
    field: "gistid"
  }, {
    title: "法人、负责⼈姓名",
    field: "businessentity"
  }
];

//type=71-历史失信被执⾏⼈的表格头
const RISK_TYPE_COLUMN_71 = [{
    title: "省份地区",
    field: "areaname"
  },
  {
    title: "法院",
    field: "courtname"
  },
  {
    title: "未履⾏部分",
    field: "unperformPart"
  },
  {
    title: "法定负责⼈/主要负责⼈信息",
    field: "staff",
  },
  {
    title: "失信人类型",
    field: "type",
  },
  {
    title: "失信⼈名称",
    field: "iname"
  }, {
    title: "失信被执⾏⼈⾏为具体情形",
    field: "disrupttypename"
  }, {
    title: "案号",
    field: "casecode"
  }, {
    title: "身份证号码/组织机构代码",
    field: "cardnum"
  }, {
    title: "履⾏情况",
    field: "performance"
  }, {
    title: "⽴案时间",
    field: "regdate",
    isDate: true
  }, {
    title: "发布时间",
    field: "publishdate",
    isDate: true
  }, {
    title: "做出执⾏的依据单位",
    field: "gistunit"
  }, {
    title: "⽣效法律⽂书确定的义务",
    field: "duty"
  }, {
    title: "执⾏依据⽂号",
    field: "gistid"
  }, {
    title: "法⼈、负责⼈姓名",
    field: "businessentity"
  }
];

//type=29-司法拍卖的表格头
const RISK_TYPE_COLUMN_29 = [{
    title: "拍卖起⽌时间",
    field: "scopeDate"
  },
  {
    title: "公布⽇期",
    field: "pubTime",
    isDate: true
  },
  {
    title: "拍卖物信息",
    field: "detail"
  },
];

//type=32限制消费令的表格头
const RISK_TYPE_COLUMN_32 = [{
    title: "案号",
    field: "caseCode"
  },
  {
    title: "创建时间",
    field: "caseCreateTime",
    isDate: true
  },
  {
    title: "类型",
    field: "qyinfoType"
  },
  {
    title: "pdf⽂件地址",
    field: "ossPath",
  }
];

//type=73-历史限制消费令的表格头
const RISK_TYPE_COLUMN_73 = [{
    title: "案号",
    field: "caseCode"
  },
  {
    title: "企业信息简称",
    field: "qyinfoAlias"
  },
  {
    title: "企业信息",
    field: "qyinfo"
  },
  {
    title: "创建时间",
    field: "caseCreateTime",
    idDate: true
  }, {
    title: "别名",
    field: "alias"
  }, {
    title: "限制消费者名称",
    field: "xname"
  }, {
    title: "申请⼈信息",
    field: "applicant"
  }, {
    title: "发布⽇期",
    field: "publishDate",
    isDate: true
  }, {
    title: "pdf地址",
    field: "filePath"
  }
];

//type=21-司法协助(公司)的表格头
const RISK_TYPE_COLUMN_21 = [{
    title: "被执⾏⼈",
    field: "executedPerson"
  },
  {
    title: "执⾏通知书⽂号",
    field: "executeNoticeNum"
  },
  {
    title: "股权数额",
    field: "equityAmount"
  },
  {
    title: "类型",
    field: "typeState"
  }, {
    title: "执⾏⼈类型",
    field: "executedPersonType"
  }, {
    title: "执⾏法院",
    field: "executiveCourt"
  }
];

//type=19-注册地址变更的表格头
const RISK_TYPE_COLUMN_19 = [{
    title: "变更时间",
    field: "changeTime",
    isDate: true
  },
  {
    title: "释意说明",
    field: "havePsersion"
  },
  {
    title: "变更后",
    field: "contentAfter"
  },
  {
    title: "创建时间",
    field: "createTime",
    timeStampNumber: true
  }, {
    title: "变更前",
    field: "contentBefore"
  }, {
    title: "变更事项",
    field: "changeItem"
  }
];

//type=75-历史司法协助的表格头
const RISK_TYPE_COLUMN_75 = [{
    title: "公示日期",
    field: "publicityDate",
    isDate: true
  },
  {
    title: "执行通知书文号",
    field: "executeNoticeNum"
  },
  {
    title: "被执行人",
    field: "executedPerson",
  },
  {
    title: "股权被执行的企业",
    field: "stockExecutedCompany",
  }, {
    title: "股权数额",
    field: "equityAmount"
  }, {
    title: "执行法院",
    field: "executiveCourt"
  }, {
    title: "类型|状态",
    field: "typeState"
  },
];

//type=11-⽋税公告的表格头
const RISK_TYPE_COLUMN_11 = [{
    title: "纳税⼈识别号",
    field: "taxIdNumber"
  },
  {
    title: "当前新发⽣⽋税余额",
    field: "newOwnTaxBalance"
  },
  {
    title: "⽋税⾦额",
    field: "ownTaxAmount"
  },
  {
    title: "发布⽇期",
    field: "publishDate",
    isDate: true
  }, {
    title: "⽋税余额",
    field: "ownTaxBalance"
  }, {
    title: "证件号码",
    field: "personIdNumber"
  }, {
    title: "⽋税税种",
    field: "taxCategory"
  }, {
    title: "纳税⼈类型",
    field: "taxpayerType"
  }, {
    title: "法⼈证件名称",
    field: "personIdName"
  }, {
    title: "纳税⼈名称",
    field: "name"
  }, {
    title: "经营地点",
    field: "location"
  }, {
    title: "税款所属税务机关",
    field: "department"
  }, {
    title: "注册类型",
    field: "regType"
  }, {
    title: "法⼈或负责⼈名称",
    field: "legalpersonName"
  }, {
    title: "税务类型",
    field: "TYPE"
  }
];

//type=46-终本案件（人）的表格头
const RISK_TYPE_COLUMN_46 = [{
    title: "案号",
    field: "caseCode"
  },
  {
    title: "被执⾏⼈名称",
    field: "zname"
  },
  {
    title: "身份证号/组织结构代码",
    field: "partyCardNum"
  }, {
    title: "执⾏法院",
    field: "execCourtName"
  }, {
    title: "终本⽇期",
    field: "caseFinalTime",
    isDate: true,
  }, {
    title: "⽴案时间",
    field: "caseCreateTime",
    isDate: true,
  }, {
    title: "执⾏标的",
    field: "execMoney"
  }, {
    title: "未履⾏⾦额",
    field: "noExecMoney"
  }
];

//type=27-立案信息的表格头
const RISK_TYPE_COLUMN_27 = [{
    title: "立案日期",
    field: "filingDate",
    timeStampNumber: true
  },
  {
    title: "案号",
    field: "caseNo"
  },
  {
    title: "案件身份",
    field: [{
        title: "原告",
        field: "plaintiff"
      },
      {
        title: "被告",
        field: "defendant"
      },
    ]
  },
  {
    title: "审理法院",
    field: "court"
  },
];

//type=26-送达公告的表格头
const RISK_TYPE_COLUMN_26 = [{
    title: "发布日期",
    field: "startDate",
    isDate: true
  },
  {
    title: "公告名称",
    field: "title"
  },
  {
    title: "法院名称",
    field: "court"
  },
  {
    title: "内容",
    field: "content"
  },
];

//type=14-法院公告的表格头
const RISK_TYPE_COLUMN_14 = [{
    title: "刊登日期",
    field: "publishdate"
  },
  {
    title: "案件号",
    field: "caseno"
  },
  {
    title: "案件内容",
    field: "content"
  },
  {
    title: "法院名",
    field: "courtcode"
  },
];

//type=8-法律诉讼的表格头
const RISK_TYPE_COLUMN_8 = [{
    title: "发布时间",
    field: "submittime",
    isDate: true
  },
  {
    title: "标题",
    field: "title"
  },
  {
    title: "案号",
    field: "caseno"
  },
  {
    title: "案件类型",
    field: "casetype"
  },
  {
    title: "原文链接地址",
    field: "lawsuitUrl",
  },
  {
    title: "法院名",
    field: "court"
  },
];

//type=13-开庭公告的表格头
const RISK_TYPE_COLUMN_13 = [{
    title: "开庭日期",
    field: "startDate",
    isDate: true
  },
  {
    title: "案号",
    field: "caseNo"
  },
  {
    title: "案由",
    field: "casereason"
  },
  {
    title: "案件身份",
    field: [{
      title: "原告",
      field: "plaintiff"
    },
    {
      title: "当事人",
      field: "litigant"
    },
  ],
  },
  {
    title: "审理法院",
    field: "courtroom"
  },
];

//type=9/77-股权出质的表格头
const RISK_TYPE_COLUMN_9 = [{
    title: "登记日期",
    field: "regDate",
    timeStampNumber: true
  },
  {
    title: "出质人",
    field: "pledgor"
  },
  {
    title: "质权人",
    field: "pledgee"
  },
  {
    title: "出质股权标的企业",
    field: ["targetCompany","targetCompany.name"]
  },
  {
    title: "出质金额",
    field: "equityAmount"
  },
];

//type=5/72-被执行人的表格头
const RISK_TYPE_COLUMN_5 = [{
    title: "创建时间",
    field: "caseCreateTime",
    isDate: true
  },
  {
    title: "案号",
    field: "caseCode"
  },
  {
    title: "被执行人名称",
    field: "pname"
  },
  {
    title: "执行标的（元）",
    field: "execMoney"
  },
  {
    title: "执行法院",
    field: "execCourtName"
  },
];

//type=12/19-预警提示的表格头
const RISK_TYPE_COLUMN_12 = [{
    title: "变更时间",
    field: "changeTime",
    isDate: true
  },
  {
    title: "变更前",
    field: "contentBefore"
  },
  {
    title: "变更后",
    field: "contentAfter"
  },
  {
    title: "变更事项",
    field: "changeItem"
  },
];

//其它的表格头
const OTHER_INFO = [{
    title: "作出决定日期",
    field: "decisionDate",
    isDate: true
  },
  {
    title: "决定文书号",
    field: "punishNumber"
  },
  {
    title: "处罚事由/违法行为类型",
    field: "type"
  },
  {
    title: "处罚结果/内容",
    field: "content"
  },
  {
    title: "作出决定机关",
    field: "departmenttitle"
  },
];

//风险类型对应的表格列
const RISK_TABLE_COLUMN_MAP = {
  "1": RISK_TYPE_COLUMN_1,
  "7": RISK_TYPE_COLUMN_1,
  "76": RISK_TYPE_COLUMN_1,
  "22": RISK_TYPE_COLUMN_22,
  "31": RISK_TYPE_COLUMN_31,
  "37": RISK_TYPE_COLUMN_37,
  "34": RISK_TYPE_COLUMN_34,
  "74": RISK_TYPE_COLUMN_74,
  "73": RISK_TYPE_COLUMN_73,
  "5": RISK_TYPE_COLUMN_5,
  "32": RISK_TYPE_COLUMN_32,
  "3": RISK_TYPE_COLUMN_3,
  "46": RISK_TYPE_COLUMN_46,
  "29": RISK_TYPE_COLUMN_29,
  "21": RISK_TYPE_COLUMN_21,
  "11": RISK_TYPE_COLUMN_11,
  "71": RISK_TYPE_COLUMN_71,
  "20": RISK_TYPE_COLUMN_19,
  "75": RISK_TYPE_COLUMN_75,
  "27": RISK_TYPE_COLUMN_27,
  "26": RISK_TYPE_COLUMN_26,
  "14": RISK_TYPE_COLUMN_14,
  "8": RISK_TYPE_COLUMN_8,
  "13": RISK_TYPE_COLUMN_13,
  "9": RISK_TYPE_COLUMN_9,
  "77": RISK_TYPE_COLUMN_9,
  "72": RISK_TYPE_COLUMN_5,
  "19": RISK_TYPE_COLUMN_12,
  "12": RISK_TYPE_COLUMN_12,
}

/**
 * 根据类型和标题获取表格头
 * @param {*} title 标题
 * @param {*} type 类型
 */
export default function (title, type) {
  return title?.endsWith("变更") ? RISK_TYPE_COLUMN_12 : (RISK_TABLE_COLUMN_MAP[type] || OTHER_INFO);
}
